let UserDao = require("./userDao")
let userNightMode = require("./userNightmodeDao")
let managerNightmodeDao = require("./managerNightmodeDao")
let managerDao = require("./managerDao")
let userTasksDao = require("./userTasksDao")
let allTasksDao = require("./allTasksDao")
let allTasksPojo = require("../models/AllTasksPojo")
let EmailController = require("../controller/EmailController")

let Utils = require("./Utils")
//update语句成功时返回的类是OkPacket
/*userNightMode.updateUserNightMode(2,0).then((results)=>{
    console.log(results)
    if(results.affectedRows>=1) {
        console.log("更新成功")
    }
})*/
//下面这行语句会报错
/*
userNightMode.updateUserNightMode(2,888).then((results)=>{
    console.log(results)
})
*/
/*managerDao.selectManager(534).then((results)=>{
    console.log(results.length)
    console.log(results)
})
managerDao.selectManager(1).then((results)=>{
    console.log(results.length)
    console.log(results)
})*/
/*userNightMode.selectUserNightMode(2).then((results)=>{
    console.log(results)

})*/
/*managerDao.selectManager(1).then((results)=>{
    console.log(results)
    let ManagerModel = results[0]
    ManagerModel.id=6
    console.log(ManagerModel)
    let insertManagerSQL = `INSERT INTO tasks.manager (id, fammily_name, given_name, sign_up_time, email, password) VALUES (${ManagerModel.id}, '${ManagerModel.fammily_name}', '${ManagerModel.given_name}', ${ManagerModel.sign_up_time}, '${ManagerModel.email}', '${ManagerModel.password}')`
    console.log(insertManagerSQL)
    managerDao.insertManager(ManagerModel)
})*/
/*allTasksDao.selectAllTasks().then((results)=>{
    for (let  result of results) {
        result.id=result.id+5
        allTasksDao.insertTask(result)
    }
})*/
/*
allTasksDao.updateTask(new allTasksPojo(22,"23234","杂务1","穿限量版飞天毛鞋1",13224234,23411324
)).then((results)=>{
    console.log(results)
    }
)
*/

/*allTasksDao.deleteATask(7).then((results)=>{

        console.log(results)

    }
)*/
/*userTasksDao.selectUserTasks(2).then((results)=>{

    console.log(results)

})*/

/*

managerNightmodeDao.updateManagerNightMode(1,0).then((results)=>{

    console.log(results)
    })
managerNightmodeDao.selectManagerNightMode(2).then((results)=>{

    console.log(results)
    })*/


/*console.log(Utils.TodayZeroTime())
console.log(Utils.TommorrowZeroTime())
console.log(Utils.TheDayAfterTommorrowZeroTime())*/
/*
allTasksDao.selectTodayTasks().then((results)=>{

    console.log(results)
})
allTasksDao.selectTommorrowTasks().then((results)=>{

    console.log(results)
})*/


// console.log(new Date("2020 6 9 00:00:00").getTime())

//allTasksDao.insertTask()
/*
let date= new Date(1591719453*1000)

console.log(date.toLocaleString())*/
/*
allTasksDao.deleteATask(2).then((results)=>{

    console.log(results)
})*/
/*
userTasksDao.insertUserTasks(1,12).then((results)=>{
    console.log(results)
})
userTasksDao.deleteUserTask(5,151).then((results)=>{
    console.log(results)
})*/
/*
UserDao.selectUserByID(1).then((results)=>{
    console.log(results)
})*/

/*
UserDao.updateUser().then((results)=>{
    console.log(results)
})*/
EmailController.taskEmailNotification("790466536@qq.com","测试邮件功能",10)